﻿Imports System.Xml
Public Class OrbComputer
    Private sessionID As String

    Sub New(ByVal sessionIDken As String)
        sessionID = sessionIDken
    End Sub

    Function getStatus(ByVal elementName As String) As String
        Dim s As String = ""
        If sessionID = "" Then Throw New Exception("No sessionID specified.")
        Dim oComm As New Communication
        s = oComm.getResponseFromOrb(Communication.APIComputerStatus, "sid=" & sessionID)
        Dim oReader As XmlNodeReader = oComm.ConvertStringToXmlReader(s)

        While oReader.Read
            If oReader.NodeType = XmlNodeType.Element Then
                If LCase(oReader.Name) = LCase(elementName) Then
                    Return oReader.ReadElementContentAsString
                    Exit While
                End If
            End If
        End While

        Return s

    End Function

End Class
